package com.kehutong.crm.message.admin;

import org.coraframework.inject.Inject;
import org.coraframework.json.JSONArray;
import org.coraframework.json.JSONObject;
import org.coraframework.mvc.MvcAction;
import org.coraframework.mvc.http.ReqMapping;
import org.coraframework.orm.jdbc.JdbcSession;
import org.coraframework.orm.util.Enums;
import org.coraframework.util.Objects;
import com.kehutong.common.DoveClient;
import com.kehutong.common.enums.MessageBusinessEnum;
import com.kehutong.common.enums.TemplateType;
import com.kehutong.common.errcode.Result;
import com.kehutong.crm.message.enums.MessageConfigEnum.Pay;
import com.kehutong.crm.message.enums.MessageConfigEnum.Resident;
import com.kehutong.crm.message.enums.MessageConfigEnum.WorkOrder;
import com.kehutong.crm.message.service.MessageAppService;
import com.kehutong.crm.message.service.MessageInnerService;
import com.kehutong.crm.message.service.MessageSmsService;

@MvcAction
@ReqMapping("/admin/crm/message/init")
public class MessageInitController {

    @Inject
    private JdbcSession jdbcSession;
    @Inject
    private MessageInnerService innerService;
    @Inject
    private MessageSmsService smsService;
    @Inject
    private MessageAppService appService;
    @Inject
    private DoveClient doveClient;

    @ReqMapping("/to")
    public Object to(String businessId, String mpAppId, String mnAppId, Boolean production) {
        if (Objects.nonEmpty(businessId)){
            MessageBusinessEnum businessEnum = Enums.getEnum(MessageBusinessEnum.class, businessId);
            sync(businessEnum, mpAppId, mnAppId, production);
        } else {
            for (MessageBusinessEnum businessEnum : MessageBusinessEnum.values()) {
                sync(businessEnum, mpAppId, mnAppId, production);
            }
        }
        return Result.success();
    }

    private void sync(MessageBusinessEnum businessEnum, String mpAppId, String mnAppId, Boolean production) {
        if (MessageBusinessEnum.MSG_WORK_ORDER == businessEnum) {
            String tagString = initWorkOrder();
            for (WorkOrder workOrder : WorkOrder.values()){
                TemplateType templateType = Enums.getEnum(TemplateType.class, workOrder.getId());
                String title = "";
                String content = "";
                String appContent = "";
                String tencentContent = "";
                int tencentTemplateId = 0;
                if (WorkOrder.WO_B_CREATE_SEND == workOrder) {
                    title = "收到新的工单";
                    content = "${createUserName}发送了一个${typeName}工单由您处理，查看详情＞＞";
                    appContent = "${createUserName}发送了一个${typeName}工单由您处理。";
                    tencentContent = "${createUserName}发送了一个${typeName}工单由您处理，详情请进入企微应用“物业通”查看。";
                    tencentTemplateId = 1084524;
                } else if (WorkOrder.WO_B_URGE == workOrder) {
                    title = "收到工单催办";
                    content = "${createUserName}的${typeName}工单申请催办，查看详情＞＞";
                    appContent = "${createUserName}的${typeName}工单申请催办。";
                    tencentContent = "${createUserName}的${typeName}工单申请催办，详情请进入企微应用“物业通”查看。";
                    tencentTemplateId = 1084528;
                } else if (WorkOrder.WO_B_DELAY_REMINDER == workOrder) {
                    title = "工单处理超时";
                    content = "${createUserName}的${typeName}工单处理已超时，查看详情＞＞";
                    appContent = "${createUserName}的${typeName}工单处理已超时。";
                    tencentContent = "${createUserName}的${typeName}工单处理已超时，详情请进入企微应用“物业通”查看。";
                    tencentTemplateId = 1084537;
                } else if (WorkOrder.WO_B_REPLY == workOrder) {
                    title = "收到工单评价";
                    content = "${createUserName}评价了${typeName}工单${id}，查看详情＞＞";
                    appContent = "${createUserName}评价了${typeName}工单${id}。";
                    tencentContent = "${createUserName}评价了${typeName}工单${id}，详情请进入企微应用“物业通”查看。。";
                    tencentTemplateId = 1084541;
                } else if (WorkOrder.WO_C_SUCCESS == workOrder) {
                    title = "工单处理完成";
                    content = "您的${typeName}工单${id}已处理完成。查看详情＞＞";
                    appContent = "您的${typeName}工单${id}已处理完成。查看详情＞＞";
                    tencentContent = "您的${typeName}工单${id}已处理完成，详情请进入微信小程序“美好小区”查看。";
                    tencentTemplateId = 1084484;
                    if (Objects.nonNull(production) && production){
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/workOrders/detail/index", "J29p9KtsMWA3eCmMZaxdJih7I9qmD3Fjb1Uvb2m78TM", businessEnum.getId(), templateType.getId(), "工单完成通知");
                    } else {
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/workOrders/detail/index", "FI0pdW-n-nUD7RKxqTe8SEjzwoaMCWfNbaEyOWy4Jds", businessEnum.getId(), templateType.getId(), "工单完成通知");
                    }
                } else if (WorkOrder.WO_C_REPLY == workOrder) {
                    title = "收到工单评价回复";
                    content = "您的${typeName}工单${id}评论有新的回复，查看详情＞＞";
                    appContent = "您的${typeName}工单${id}评论有新的回复，查看详情＞＞";
                    tencentContent = "您的${typeName}工单${id}评论有新的回复，详情请进入微信小程序“美好小区”查看。";
                    tencentTemplateId = 1084491;
                    if (Objects.nonNull(production) && production){
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/workOrders/detail/index", "IpcjHjZRYlq2gImsnPq7MC2cs5U4ixyPUnnUejHGfzc", businessEnum.getId(), templateType.getId(), "用户评价通知");
                    } else {
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/workOrders/detail/index", "EebmA960wYhylBI5P4Q4p8XyzRhCDhkR5nhMFx19fjU", businessEnum.getId(), templateType.getId(), "用户评价通知");
                    }

                } else {
                    // 暂时没有配置...
                    continue;
                }
                innerService.init(tagString, title, content, templateType, businessEnum);
                smsService.init(tagString, title, tencentContent, templateType, businessEnum, tencentTemplateId);
                appService.init(tagString, title, appContent, templateType, businessEnum);

            }
        }
        if (MessageBusinessEnum.MSG_RESIDENT == businessEnum) {
            String tagString = initResident();
            for (Resident resident : Resident.values()){
                TemplateType templateType = Enums.getEnum(TemplateType.class, resident.getId());
                String title = "";
                String content = "";
                String appContent = "";
                String tencentContent = "";
                int tencentTemplateId = 0;
                if (Resident.RESIDENT_B_ADD == resident) {
                    title = "新增住户提醒";
                    content = "您有一个新的住户加入，查看详情＞＞";
                    appContent = "您有一个新的住户加入。";
                    tencentContent = "您有一个新的住户加入，详情请进入企微应用“物业通”查看。";
                    tencentTemplateId = 1084722;
                } else if (Resident.RESIDENT_B_AUDIT == resident) {
                    title = "收到新的住户申请";
                    content = "${realname}申请绑定${communityName}${buildName}${floorName}${houseName}，查看详情＞＞";
                    appContent = "${realname}申请绑定${communityName}${buildName}${floorName}${houseName}";
                    tencentContent = "${realname}申请绑定${communityName}${buildName}${houseName}，详情请进入企微应用“物业通”查看。";
                    tencentTemplateId = 1089208;
                } else if (Resident.RESIDENT_C_AUDIT_SUCCESS == resident) {
                    title = "住户审核结果通知";
                    content = "您的住户申请已审核通过，查看详情＞＞";
                    appContent = "您的住户申请已审核通过。";
                    tencentContent = "您的住户申请${id}已审核通过，详情请进入微信小程序“美好小区”查看。";
                    tencentTemplateId = 1084512;
                    if (Objects.nonNull(production) && production){
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/houses/list/index", "slYCViZfugtrd5EBBFnJsxsQxCUlEt6Zje2AqePyXjA", businessEnum.getId(), templateType.getId(), "住户审核提醒");
                    } else {
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/houses/list/index", "2k8QpYRhmZWJrpm9lYoi8neCWr9BSdgN9HnP4rhKsTY", businessEnum.getId(), templateType.getId(), "住户审核提醒");
                    }
                } else if (Resident.RESIDENT_C_AUDIT_FAIL == resident) {
                    title = "住户审核结果通知";
                    content = "您的住户申请审核不通过，备注：${auditRemarks}，查看详情＞＞";
                    appContent = "您的住户申请审核不通过，备注：${auditRemarks}，查看详情＞＞";
                    tencentContent = "您的住户申请审核不通过，备注：${auditRemarks}，详情请进入微信小程序“美好小区”查看。";
                    tencentTemplateId = 1089211;
                    if (Objects.nonNull(production) && production){
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/houses/list/index", "-IqRgblsDZ31jTPFujFKj6kmW0RG2FlsEyQ9SexgTVY", businessEnum.getId(), templateType.getId(), "住户审核提醒");
                    } else {
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/houses/list/index", "drzem6U2LpUtWJLlahJdmoaB1a_WKUduxlck4c7oF1w", businessEnum.getId(), templateType.getId(), "住户审核提醒");
                    }
                } else {
                    // 暂时没有配置...
                    continue;
                }
                innerService.init(tagString, title, content, templateType, businessEnum);
                smsService.init(tagString, title, tencentContent, templateType, businessEnum, tencentTemplateId);
                appService.init(tagString, title, appContent, templateType, businessEnum);
            }
        }
        if (MessageBusinessEnum.MSG_BILL_PAY == businessEnum) {
            for (Pay pay : Pay.values()){
                TemplateType templateType = Enums.getEnum(TemplateType.class, pay.getId());
                String tagString = "";
                String title = "";
                String innerContent = "";
                String appContent = "";
                String tencentContent = "";
                int tencentTemplateId = 0;
                if (Pay.PAY_B_TASK_REMIND == pay) {
                    // ChargeUrgingManage
                    tagString = initChargeUrgingManage();
                    title = "催费提醒";

                    innerContent = "本期账单有${urgingTotal}户未缴费，点击查看＞＞";
                    appContent = "本期账单有${urgingTotal}户未缴费";
                    tencentContent = "本期有${urgingTotal}户未缴费，详情请进入企微应用“物业通”查看。";
                    tencentTemplateId = 1084557;
                } else if (Pay.PAY_B_TASK_SUCCESS_REMIND == pay) {
                    //ChargeOrderManage
                    tagString = initChargeOrder();
                    title = "已缴费提醒";
                    innerContent = "${chargeName}的账单${houseBillNo}已缴费，点击查看＞＞";
                    appContent = "${chargeName}的账单${houseBillNo}已缴费";
                    tencentContent = "${chargeName}的账单${houseBillNo}已缴费，详情请进入企微应用“物业通”查看。";
                    tencentTemplateId = 1092677;
                } else if (Pay.PAY_C_MONTH_BILL_DATE == pay) {
                    //ChargeBillItems
                    tagString = initBillItems();
                    title = "月度账单通知";
                    innerContent = "您【${communityName}${billAddress}】本期${billYearMonth}的账单已出账，金额为${billAmount}，查看详情＞＞";
                    appContent = "您$【${communityName}{billAddress}】本期${billYearMonth}的账单已出账，金额为${billAmount}，查看详情＞＞";
                    tencentContent = "您${billAddress}本期账单${billYearMonth}已出账，金额为${billAmount}，详情请进入微信小程序“美好小区”查看。";
                    tencentTemplateId = 1084496;

                    if (Objects.nonNull(production) && production){// 正式
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/billsv2/list/index", "sa-EF8f52qRumTS_rvz7HXu2iA-PeElrg64EHW3G25I", businessEnum.getId(), templateType.getId(), "月度账单通知");
                    } else {// 测试
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/billsv2/list/index", "Aj9sB7ySeUugVqi3-Eziy2c3AvNAdMD_OV8HANItFyM", businessEnum.getId(), templateType.getId(), "月度账单通知");
                    }
                } else if (Pay.PAY_C_TASK_REMIND == pay) {
                    //FeeMsgDetailVO
                    tagString = initFeeMsgDetailVO();
                    title = "物业费缴纳通知";

                    innerContent = "您【${communityName}${address}】本期${currentMonth}的账单已出账，点查看详情＞＞";
                    appContent = "您【${communityName}${address}】本期${currentMonth}的账单已出账，点查看详情＞＞";
                    tencentContent = "尊敬的${ownerName}，您好，您${currentMonth}的费用情况：${address}：${feeTypeName}:当月${currentAmountTotal}，往月应缴${historyAmountTotal}；合计：${allAmountTotal}，详情请进入微信小程序“美好小区”查看。";
                    tencentTemplateId = 1084502;

                    if (Objects.nonNull(production) && production){// 正式
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/billsv2/list/index", "bBisAO4EMpMXHhBHEPleLu0wk7l6Cwb2abWVSWtkhXI", businessEnum.getId(), templateType.getId(), "缴费成功提醒");
                    } else {// 测试
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/billsv2/list/index", "ZOMsMu8ep3loYV6wv02rZka-ZDy0ZRPWqLOu_uumkOE", businessEnum.getId(), templateType.getId(), "缴费成功提醒");
                    }
                } else if (Pay.PAY_C_BILL_SUCCESS == pay) {
                    //ChargeOrderManage
                    tagString = initChargeOrder();
                    title = "缴费成功提醒";
                    innerContent = "您【${communityName}${billAddress}】的缴费已收到，查看详情＞＞";
                    appContent = "您【${communityName}${billAddress}】的缴费已收到，查看详情＞＞";
                    tencentContent = "您${billAddress}的缴费已收到，详情请进入微信小程序“美好小区”查看。";
                    tencentTemplateId = 1084509;

                    if (Objects.nonNull(production) && production){// 正式
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/billsv2/list/index", "tWVlTseqj44Sbx9S_Meea2NnbELyagsgMVTKGmV5nbs", businessEnum.getId(), templateType.getId(), "缴费成功提醒");
                    } else {// 测试
                        syncWxchatTemplate(mpAppId, mnAppId, "/pages/billsv2/list/index", "KSbuzv4w45r4w6SW5f2WCv-5T88nYWvMsPol6jUup64", businessEnum.getId(), templateType.getId(), "缴费成功提醒");
                    }
                } else {
                    // 暂时没有配置...
                    continue;
                }
                innerService.init(tagString, title, innerContent, templateType, businessEnum);
                smsService.init(tagString, title, tencentContent, templateType, businessEnum, tencentTemplateId);
                appService.init(tagString, title, appContent, templateType, businessEnum);
            }
        }
    }

    private void syncWxchatTemplate(String mpAppId, String mnAppId, String miniPagePath, String templateNo, String businessType, String templateType, String name){
        try {
            doveClient.post("/wechat/template/setting/service/init", http -> {
                JSONObject requestJson = new JSONObject();
                requestJson.put("name", name);
                requestJson.put("templateNo", templateNo);
                requestJson.put("businessType", businessType);
                requestJson.put("templateType", templateType);
                requestJson.put("appId", mpAppId);
                requestJson.put("miniAppId", mnAppId);
                requestJson.put("miniPagePath", miniPagePath);

                http.setBody(requestJson.toJSONString());
            });
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    private String initWorkOrder() {
        JSONObject j1 = new JSONObject();
        j1.put("label", "工单编号");
        j1.put("value", "${id}");
        JSONObject j2 = new JSONObject();
        j2.put("label", "工单标题");
        j2.put("value", "${name}");
        JSONObject j3 = new JSONObject();
        j3.put("label", "小区名称");
        j3.put("value", "${communityName}");
        JSONObject j4 = new JSONObject();
        j4.put("label", "工单内容");
        j4.put("value", "${content}");
        JSONObject j5 = new JSONObject();
        j5.put("label", "处理人员名字");
        j5.put("value", "${handleEmployeeName}");
        JSONObject j6 = new JSONObject();
        j6.put("label", "处理人员部门");
        j6.put("value", "${handleDepartName}");
        JSONObject j7 = new JSONObject();
        j7.put("label", "发起人手机号");
        j7.put("value", "${createPhone}");
        JSONObject j8 = new JSONObject();
        j8.put("label", "工单状态");
        j8.put("value", "${workOrderState}");
        JSONObject j9 = new JSONObject();
        j9.put("label", "提交人员名字");
        j9.put("value", "${createUserName}");
        JSONObject j10 = new JSONObject();
        j10.put("label", "工单类型");
        j10.put("value", "${typeName}");

        JSONArray jsonArray = new JSONArray();
        jsonArray.add(j1);
        jsonArray.add(j2);
        jsonArray.add(j3);
        jsonArray.add(j4);
        jsonArray.add(j5);
        jsonArray.add(j6);
        jsonArray.add(j7);
        jsonArray.add(j8);
        jsonArray.add(j9);
        jsonArray.add(j10);

        return jsonArray.toJSONString();
    }
    private String initResident(){
        JSONObject j0 = new JSONObject();
        j0.put("label", "申请编号");
        j0.put("value", "${id}");
        JSONObject j1 = new JSONObject();
        j1.put("label", "住户编号");
        j1.put("value", "${residentNo}");
        JSONObject j2 = new JSONObject();
        j2.put("label", "房屋类型");
        j2.put("value", "${houseType}");
        JSONObject j3 = new JSONObject();
        j3.put("label", "申请人姓名");
        j3.put("value", "${realname}");
        JSONObject j4 = new JSONObject();
        j4.put("label", "申请人手机号");
        j4.put("value", "${mobile}");
        JSONObject j5 = new JSONObject();
        j5.put("label", "申请人身份");
        j5.put("value", "${type}");
        JSONObject j6 = new JSONObject();
        j6.put("label", "小区名称");
        j6.put("value", "${communityName}");
        JSONObject j7 = new JSONObject();
        j7.put("label", "小区别名");
        j7.put("value", "${communityViewName}");
        JSONObject j8 = new JSONObject();
        j8.put("label", "楼栋名称");
        j8.put("value", "${buildName}");
        JSONObject j9 = new JSONObject();
        j9.put("label", "单元名称");
        j9.put("value", "${unitName}");
        JSONObject j10 = new JSONObject();
        j10.put("label", "楼层名称");
        j10.put("value", "${floorName}");
        JSONObject j11 = new JSONObject();
        j11.put("label", "房屋名称");
        j11.put("value", "${houseName}");
        JSONObject j12 = new JSONObject();
        j12.put("label", "房屋别名");
        j12.put("value", "${houseViewName}");
        JSONObject j13 = new JSONObject();
        j13.put("label", "审核状态");
        j13.put("value", "${status}");
        JSONObject j14 = new JSONObject();
        j14.put("label", "审核人名称");
        j14.put("value", "${auditName}");
        JSONObject j15 = new JSONObject();
        j15.put("label", "审核备注");
        j15.put("value", "${auditRemarks}");

        JSONArray jsonArray = new JSONArray();
        jsonArray.add(j1);
        jsonArray.add(j2);
        jsonArray.add(j3);
        jsonArray.add(j4);
        jsonArray.add(j5);
        jsonArray.add(j6);
        jsonArray.add(j7);
        jsonArray.add(j8);
        jsonArray.add(j9);
        jsonArray.add(j10);
        jsonArray.add(j11);
        jsonArray.add(j12);
        jsonArray.add(j13);
        jsonArray.add(j14);
        jsonArray.add(j15);

        return jsonArray.toJSONString();
    }
    private String initFeeMsgDetailVO(){
        JSONObject j1 = new JSONObject();
        j1.put("label", "当前月");
        j1.put("value", "${currentMonth}");
        JSONObject j2 = new JSONObject();
        j2.put("label", "当前月欠费总额");
        j2.put("value", "${currentAmountTotal}");
        JSONObject j3 = new JSONObject();
        j3.put("label", "历史月欠费总额");
        j3.put("value", "${historyAmountTotal}");
        JSONObject j4 = new JSONObject();
        j4.put("label", "缴费人名称");
        j4.put("value", "${ownerName}");
        JSONObject j5 = new JSONObject();
        j5.put("label", "缴费人手机号");
        j5.put("value", "${ownerMobile}");
        JSONObject j6 = new JSONObject();
        j6.put("label", "小区名称");
        j6.put("value", "${communityName}");
        JSONObject j7 = new JSONObject();
        j7.put("label", "缴费地址");
        j7.put("value", "${address}");
        JSONArray jsonArray = new JSONArray();
        jsonArray.add(j1);
        jsonArray.add(j2);
        jsonArray.add(j3);
        jsonArray.add(j4);
        jsonArray.add(j5);
        jsonArray.add(j6);
        jsonArray.add(j7);
        return jsonArray.toJSONString();
    }
    private String initBillItems(){
        JSONObject j1 = new JSONObject();
        j1.put("label", "小区名称");
        j1.put("value", "${communityName}");
        JSONObject j2 = new JSONObject();
        j2.put("label", "账单地址");
        j2.put("value", "${billAddress}");
        JSONObject j3 = new JSONObject();
        j3.put("label", "账单编号");
        j3.put("value", "${houseBillNo}");
        JSONObject j4 = new JSONObject();
        j4.put("label", "账单年月");
        j4.put("value", "${billYearMonth}");
        JSONObject j5 = new JSONObject();
        j5.put("label", "出账单日");
        j5.put("value", "${billDate}");
        JSONObject j6 = new JSONObject();
        j6.put("label", "记账周期开始");
        j6.put("value", "${billCycleStart}");
        JSONObject j7 = new JSONObject();
        j7.put("label", "记账周期结束");
        j7.put("value", "${billCycleEnd}");
        JSONObject j8 = new JSONObject();
        j8.put("label", "缴费时间");
        j8.put("value", "${chargeDate}");
        JSONObject j9 = new JSONObject();
        j9.put("label", "手机号码");
        j9.put("value", "${mobile}");
        JSONObject j10 = new JSONObject();
        j10.put("label", "账单金额");
        j10.put("value", "${billAmount}");

        JSONArray jsonArray = new JSONArray();
        jsonArray.add(j1);
        jsonArray.add(j2);
        jsonArray.add(j3);
        jsonArray.add(j4);
        jsonArray.add(j5);
        jsonArray.add(j6);
        jsonArray.add(j7);
        jsonArray.add(j8);
        jsonArray.add(j9);
        jsonArray.add(j10);
        return jsonArray.toJSONString();
    }

    private String initChargeUrgingManage(){
        JSONObject j1 = new JSONObject();
        j1.put("label", "催费编号");
        j1.put("value", "${urgingNo}");
        JSONObject j2 = new JSONObject();
        j2.put("label", "小区名称");
        j2.put("value", "${communityName}");
        JSONObject j3 = new JSONObject();
        j3.put("label", "账单编号");
        j3.put("value", "${houseBillNo}");
        JSONObject j4 = new JSONObject();
        j4.put("label", "总人数");
        j4.put("value", "${urgingTotal}");

        JSONArray jsonArray = new JSONArray();
        jsonArray.add(j1);
        jsonArray.add(j2);
        jsonArray.add(j3);
        jsonArray.add(j4);
        return jsonArray.toJSONString();
    }

    private String initChargeOrder(){
        JSONObject j1 = new JSONObject();
        j1.put("label", "订单编号");
        j1.put("value", "${orderNo}");
        JSONObject j2 = new JSONObject();
        j2.put("label", "账单编号");
        j2.put("value", "${houseBillNo}");
        JSONObject j3 = new JSONObject();
        j3.put("label", "小区账单编号");
        j3.put("value", "${communityBillNo}");
        JSONObject j4 = new JSONObject();
        j4.put("label", "小区名称");
        j4.put("value", "${communityName}");
        JSONObject j5 = new JSONObject();
        j5.put("label", "账单地址");
        j5.put("value", "${billAddress}");
        JSONObject j6 = new JSONObject();
        j6.put("label", "订单年月");
        j6.put("value", "${orderYearMonth}");
        JSONObject j7 = new JSONObject();
        j7.put("label", "账单金额");
        j7.put("value", "${billAmount}");
        JSONObject j8 = new JSONObject();
        j8.put("label", "订单金额");
        j8.put("value", "${orderAmount}");
        JSONObject j9 = new JSONObject();
        j9.put("label", "应付金额");
        j9.put("value", "${payableAmount}");
        JSONObject j10 = new JSONObject();
        j10.put("label", "实付金额");
        j10.put("value", "${paymentAmount}");
        JSONObject j11 = new JSONObject();
        j11.put("label", "议价金额");
        j11.put("value", "${negotiateAmount}");
        JSONObject j12 = new JSONObject();
        j12.put("label", "输入金额");
        j12.put("value", "${inputAmount}");
        JSONObject j13 = new JSONObject();
        j13.put("label", "订单状态");
        j13.put("value", "${orderStatus}");
        JSONObject j14 = new JSONObject();
        j14.put("label", "支付方式");
        j14.put("value", "${payMethod}");
        JSONObject j15 = new JSONObject();
        j15.put("label", "支付时间");
        j15.put("value", "${payTime}");
        JSONObject j16 = new JSONObject();
        j16.put("label", "完成时间");
        j16.put("value", "${finishTime}");
        JSONObject j17 = new JSONObject();
        j17.put("label", "平台订单编号");
        j17.put("value", "${orderNoThird}");
        JSONObject j18 = new JSONObject();
        j18.put("label", "付款人名称");
        j18.put("value", "${chargeName}");

        JSONArray jsonArray = new JSONArray();
        jsonArray.add(j1);
        jsonArray.add(j2);
        jsonArray.add(j3);
        jsonArray.add(j4);
        jsonArray.add(j5);
        jsonArray.add(j6);
        jsonArray.add(j7);
        jsonArray.add(j8);
        jsonArray.add(j9);
        jsonArray.add(j10);
        jsonArray.add(j11);
        jsonArray.add(j12);
        jsonArray.add(j13);
        jsonArray.add(j14);
        jsonArray.add(j15);
        jsonArray.add(j16);
        jsonArray.add(j17);
        jsonArray.add(j18);
        return jsonArray.toJSONString();
    }

}
